package com.byxy.luntan.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.byxy.luntan.entity.Tip;
import com.byxy.luntan.entity.User;

public interface UserDao {
	@Results(id = "usermap", value = {
			@Result(column = "user_id",property = "userId",id = true),
			@Result(column = "user_name",property = "userName"),
			@Result(column = "user_nick",property = "userNick"),
			@Result(column = "user_password",property = "userPassword"),
			@Result(column = "user_status",property = "userStatus"),
			@Result(column = "user_type",property = "userType")
		})
		@Select("select * from user where user_id=#{userId}")
		User getById(Integer userId);
		

		@ResultMap("usermap")
		@Select("select * from user where user_name=#{userName} and user_password =#{userPassword}")
		// 参数多于1个，必须加 @Param
		User getByNameAndPassword(@Param("userName") String userName, @Param("userPassword") String userPassword);



//		@Insert("insert into user(user_name,user_nick,user_password,user_type) values(#{userName},#{userNick},#{userPassword},#{userType})")	
//	@InsertProvider(value=com.byxy.luntan.dao.UserProvider.class,method = "insertUser")
//		void save(@Param("user") User user);
		@InsertProvider(type=UserProvider.class,method="insert")
		public void save(User user);
			
		
		



}

